package edu.xust.web.controller;

import edu.xust.config.*;
import edu.xust.dto.BaseDto;
import edu.xust.dto.MessageEnum;
import edu.xust.entity.PostServiceBean;
import edu.xust.service.PostService;

@Controller("/postServiceController")
public class PostServiceController {

    @Resource
    private PostService postService;
    /**
     * 查询全部后期服务
     *
     * @return
     */
    @RequestMapping("/findAllPostService")
    @ResponseBody
    public BaseDto findAllPostService() {
        return postService.getAllPostServiceBean();
    }

    /**
     * 查询全部
     *
     * @param pid
     * @return
     */
    @RequestMapping("/findPostServiceByPID/{pid}")
    @ResponseBody
    public BaseDto findPostServiceByPID(String pid) {
        System.out.println(pid);
        return postService.getPostServiceBeanByPID(Integer.valueOf(pid));
    }

    @RequestMapping("/addPostService")
    @ResponseBody
    public BaseDto addPostService(PostServiceBean postServiceBean) {
        BaseDto<Object> dto = new BaseDto<>(MessageEnum.ADDPOSTSERVICESUCCESS, postServiceBean);
        return dto;
    }

    @RequestMapping("/changePostService")
    @ResponseBody
    public BaseDto changePostService(@RequestBody PostServiceBean postServiceBean) {
        BaseDto<PostServiceBean> dto = new BaseDto<>(MessageEnum.CHANGEPOSTSERVICE, postServiceBean);
        return dto;
    }
}
